package com.yh.gulimall.order.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.yh.common.utils.PageUtils;
import com.yh.gulimall.order.entity.OrderEntity;
import com.yh.gulimall.order.vo.*;

import java.util.Map;
import java.util.concurrent.ExecutionException;

/**
 * 订单
 *
 * @author yanghuan
 * @email yanghuan@gmail.com
 * @date 2021-04-26 17:53:16
 */
public interface OrderService extends IService<OrderEntity> {

    PageUtils queryPage(Map<String, Object> params);

    /**
     * 给订单确认页返回所需数据
     * @return
     */
    OrderConfirmVo confirmOrder() throws ExecutionException, InterruptedException;

    /**
     * 下单操作
     * @param orderSubmitVo
     * @return
     */
    SubmitOrderResponseVo submitOrder(OrderSubmitVo orderSubmitVo);

    /**
     * 根据订单号查询订单
     * @param orderSn
     * @return
     */
    OrderEntity getOrderByOrderSn(String orderSn);

    /**
     * 处理订单过期，进行关闭订单
     * @param orderEntity
     */
    void closeOrder(OrderEntity orderEntity);

    /**
     * 获取支付订单的信息
     * @param orderSn
     * @return
     */
    PayVo getPayOrder(String orderSn);

    /**
     * 分页查询当前用户的订单列表
     * @param params
     * @return
     */
    PageUtils queryPageWithItem(Map<String, Object> params);

    /**
     * 根据支付成功与否来修改订单的状态
     * @param payAsyncVo
     * @return
     */
    String handlePayResult(PayAsyncVo payAsyncVo);
}

